/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bgu.sonar.util.strings;

import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author bennyl
 */
public class StringInputStream extends InputStream {

    private byte[] data;
    private int idx = 0;

    public StringInputStream(String data) {
        this.data = data.getBytes();
    }

    @Override
    public int read() throws IOException {
        if (idx >= data.length) {
            return -1;
        }
        return data[idx++];
    }
}
